/*    file: ScaleContext.h
 *    desc:
 *   
 * created: 2014-01-21 16:58:16
 *  author: zhengchuanjiang
 * company: 
 */ 


#if !defined SCALECONTEXT_H_
#define SCALECONTEXT_H_

#include "BasicType.h"
#include "Ffmpeg.h"
////////////////////////////////////////////////////////////////////////////
class ScaleContext
{
public:
    explicit ScaleContext(AVPixelFormat destFmt = AV_PIX_FMT_RGB32);
    ~ScaleContext();

    void reset();

    bool update(AVFrame* pFrame, int width, int height);

    bool update(AVFrame* pFrame, int width, int height, AVPixelFormat destFmt);

public:
    SwsContext* m_pContext;
    
    AVPixelFormat m_fmt;

    int m_srcWidth;
    int m_srcHeight;

    int m_outWidth;
    int m_outHeight;

protected:
    AVPixelFormat m_destFormat;

};

////////////////////////////////////////////////////////////////////////////
#endif //SCALECONTEXT_H_

